#!/usr/bin/env node

/**
 * NodeOS
 *
 * @copyright 2013-2017 Jacob Groundwater, Jesús Leganés-Combarro 'piranna'
 *  and other contributors
 *
 * @license MIT
 */

const spawn = require('child_process').spawn

const prepareCommandLine = require('..')


const {command, argv, cwd} = prepareCommandLine(process.argv.slice(2))


// Exec NodeOS
spawn(command, argv, {stdio: 'inherit', cwd})
.on('error', console.trace.bind(console))
.on('exit', function(code, signal)
{
  process.exit(code || signal)
})
